#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>

#include "stack.h"
#include "queue.h"
#include "priority_queue.h"

void test_stack()
{
	csy::stack<int> st;
	st.push(1);
	st.push(2);
	st.push(3);
	st.push(4);

	while (!st.empty())
	{
		std::cout << st.top() << std::endl;
		st.pop();
	}
}

void test_queue()
{
	csy::queue<int> q;
	q.push(1);
	q.push(2);
	q.push(3);
	q.push(4);

	while (!q.empty())
	{
		cout << q.front() << endl;
		q.pop();
	}
}

void test_op()
{
	srand(time(0));
	const int N = 100000;
	vector<int> v;
	v.reserve(N);


	deque<int> dp;

	for (int i = 0; i < N; ++i)
	{
		auto e = rand();
		v.push_back(e);
		dp.push_back(e);
	}

	int begin1 = clock();
	sort(v.begin(), v.end());
	int end1 = clock();

	int begin2 = clock();
	sort(dp.begin(), dp.end());
	int end2 = clock();

	printf("vector sort:%d\n", end1 - begin1);
	printf("deque sort:%d\n", end2 - begin2);
}

void test_priority_queue()
{
	//priority_queue<int,vector<int>,greater<int>> pq;
	//vector<int> nums = { 10,2,3,8,5,6,7,4,9,0 };
	//csy::priority_queue<int,vector<int>,greater<int>> pq(nums.begin(), nums.end());
	less<int> ls;
	greater<int> gt;
	std::priority_queue<int> pq(ls);

	pq.push(1);
	pq.push(7);
	pq.push(20);
	pq.push(4);
	pq.push(5);
	pq.push(3);
	pq.push(2);
	pq.push(1);

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}

	cout << endl;
}

void test_sort()
{
	vector<int> v = { 8,3,9,4,2,1,10 };
	sort(v.begin(), v.end(),greater<int>());
	for (auto e : v)
	{
		cout << e << " ";
	}

	cout << endl;
}


int main()
{
	test_priority_queue();
	//test_sort();
	/*const int& a = int(2);
	cout << a << endl;*/
	return 0;
}